package com.ruoyi.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.domain.ShoppingCart;
import com.ruoyi.system.domain.ShoppingCartDto;
import com.ruoyi.system.mapper.ShoppingCartMapper;
import com.ruoyi.system.service.ShoppingCartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, ShoppingCart> implements ShoppingCartService {
    @Autowired
    private ShoppingCartMapper shoppingCartMapper;

    @Override
    public ShoppingCart getByShoppingCartId(Integer shoppingCartId) {
        ShoppingCart byShoppingCartId = shoppingCartMapper.getByShoppingCartId(shoppingCartId);
        return byShoppingCartId;
    }

    @Override
    public Integer deleteByShoppingCartId(int id) {
        Integer integer = shoppingCartMapper.deleteByShoppingCartId(id);
        return integer;
    }

    @Override
    public Integer update(Integer num, Integer shoppingCartId) {
        Integer update = shoppingCartMapper.update(num, shoppingCartId);
        return update;
    }

    @Override
    public int insert(ShoppingCart shoppingCart) {
        int insert = shoppingCartMapper.insert(shoppingCart);
        return insert;
    }

    @Override
    public ShoppingCart getByUidPid(Integer user_id, Integer product_id) {
        ShoppingCart byUidPid = shoppingCartMapper.getByUidPid(user_id, product_id);
        return byUidPid;
    }

    @Override
    public List<ShoppingCartDto> getByUserId(Integer user_id) {
        List<ShoppingCartDto> byUserId = shoppingCartMapper.getByUserId(user_id);
        return byUserId;
    }

    @Override
    public Integer updateDelete(Integer shoppingCartId, Integer isexit) {
        Integer integer = shoppingCartMapper.updateDelete(shoppingCartId, isexit);
        return integer;
    }

    @Override
    public ShoppingCart getByShoppingCartId1(Integer shoppingCartId) {
        ShoppingCart byShoppingCartId1 = shoppingCartMapper.getByShoppingCartId1(shoppingCartId);
        return byShoppingCartId1;
    }
}
